import {html, TemplateResult} from 'lit';
import type {Meta, StoryObj} from '@storybook/web-components';
import "../../../echarts/bar/lit-bar-y.ts"
import {BarYProps} from "../../../echarts/bar/lit-bar-y.ts";

const meta: Meta<BarYProps> = {
    title: 'Echarts/LitBarY',
    tags: ['autodocs'],
    parameters: {
        docs: {
            description: {
                component: 'tooltip以及其他各类事件暂时无法在storybook中使用，具体请参考echarts的文档',
            },
        }
    },
    render: (args: BarYProps): TemplateResult => {
        return html`<lit-bar-y 
            .chartId=${args.chartId}
            .width=${args.width}
            .height=${args.height}
            .title=${args.title}
            .tooltip=${args.tooltip}
            .legend=${args.legend}
            .grid=${args.grid}
            .yAxisData=${args.yAxisData}
            .seriesData=${args.seriesData}
        />`;
    },
    argTypes: {
        chartId: { control: 'text' },
        width: { control: 'text' },
        height: { control: 'text' },
        title: { control: 'object' },
        tooltip: { control: 'object' },
        legend: { control: 'object' },
        grid: { control: 'object' },
        yAxisData: { control: 'object' },
        seriesData: { control: 'object' },
    },
};

export default meta;
type Story = StoryObj<BarYProps>;

export const Default: Story = {
    args: {
        chartId: 'bar-y-chart',
        width: '1200px',
        height: '600px',
        title: {text: 'World Population'},
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: ['2011', '2012'],
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        yAxisData: ['Brazil', 'Indonesia', 'USA', 'India', 'China', 'World'],
        seriesData: [
            [18203, 23489, 29034, 104970, 131744, 630230],
            [19325, 23438, 31000, 121594, 134141, 681807]
        ]
    }
};